#pragma once

#include <boost/signals2/signal.hpp>
#include <boost/thread.hpp>

namespace behavior_controller
{
    namespace occur
    {

        class OccurRegister
        {
        public:
            virtual ~OccurRegister() = default;
            virtual void Deregister() = 0;
        };

        template <typename Evt>
        class EventRegisterImpl : public OccurRegister
        {
        public:
            EventRegisterImpl(boost::signals2::connection conn)
                : is_deregisted_(false), conn_(conn)
            {
            }

            void Deregister() override
            {
                Evt::Deregister(conn_);
                is_deregisted_ = true;
            }

        private:
            bool is_deregisted_;
            boost::signals2::connection conn_;
        };

    } // namespace occur
} // namespace behavior_controller
